package android.FiltrosJava;

public class Dissolve extends PointFilter{
	protected double percDissolve;
	public Dissolve(double percentDissolve){		
		this.percDissolve = percentDissolve;
		if (this.percDissolve > 1.0f){
			this.percDissolve = percentDissolve % 100;
			this.percDissolve = (float) (this.percDissolve /100.0f);
		}		
	}
	
	public int[] computeFilter(int px, int py, int[] imageData){			
		double p = Math.random();		
		if (p <= this.percDissolve){
			imageData[0] = 255;
			imageData[1] = 255;
			imageData[2] = 255;					
		}			
		return imageData;
	}
}